/**
 *
 */
import Util;
import OpenApi;

import EndpointUtil;

extends OpenApi;

init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  

  checkConfig(config);
  @endpoint = getEndpoint('iqa', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }

  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model CreateProjectRequest {
  projectName?: string(name='ProjectName'),
  modelId?: string(name='ModelId'),
  projectType?: string(name='ProjectType'),
}

model CreateProjectResponseBody = {
  requestId?: string(name='RequestId'),
  projectId?: string(name='ProjectId'),
}

model CreateProjectResponse = {
  headers: map[string]string(name='headers'),
  body: CreateProjectResponseBody(name='body'),
}

async function createProjectWithOptions(request: CreateProjectRequest, runtime: Util.RuntimeOptions): CreateProjectResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('CreateProject', '2019-08-13', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function createProject(request: CreateProjectRequest): CreateProjectResponse {
  var runtime = new Util.RuntimeOptions{};
  return createProjectWithOptions(request, runtime);
}

model DeleteProjectRequest {
  projectId?: string(name='ProjectId'),
}

model DeleteProjectResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteProjectResponse = {
  headers: map[string]string(name='headers'),
  body: DeleteProjectResponseBody(name='body'),
}

async function deleteProjectWithOptions(request: DeleteProjectRequest, runtime: Util.RuntimeOptions): DeleteProjectResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DeleteProject', '2019-08-13', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function deleteProject(request: DeleteProjectRequest): DeleteProjectResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteProjectWithOptions(request, runtime);
}

model DeployServiceRequest {
  projectId?: string(name='ProjectId'),
}

model DeployServiceResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeployServiceResponse = {
  headers: map[string]string(name='headers'),
  body: DeployServiceResponseBody(name='body'),
}

async function deployServiceWithOptions(request: DeployServiceRequest, runtime: Util.RuntimeOptions): DeployServiceResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DeployService', '2019-08-13', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function deployService(request: DeployServiceRequest): DeployServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deployServiceWithOptions(request, runtime);
}

model DescribeProjectRequest {
  projectId?: string(name='ProjectId'),
}

model DescribeProjectResponseBody = {
  questionCount?: int32(name='QuestionCount'),
  deployAvailable?: string(name='DeployAvailable'),
  modelName?: string(name='ModelName'),
  requestId?: string(name='RequestId'),
  projectName?: string(name='ProjectName'),
  createTime?: long(name='CreateTime'),
  projectId?: string(name='ProjectId'),
  onlineServiceStatus?: string(name='OnlineServiceStatus'),
  deployTime?: long(name='DeployTime'),
  projectType?: string(name='ProjectType'),
  dataStatus?: string(name='DataStatus'),
  modelId?: string(name='ModelId'),
  testServiceStatus?: string(name='TestServiceStatus'),
}

model DescribeProjectResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeProjectResponseBody(name='body'),
}

async function describeProjectWithOptions(request: DescribeProjectRequest, runtime: Util.RuntimeOptions): DescribeProjectResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeProject', '2019-08-13', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeProject(request: DescribeProjectRequest): DescribeProjectResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeProjectWithOptions(request, runtime);
}

model GetPredictResultRequest {
  projectId?: string(name='ProjectId'),
  question?: string(name='Question'),
  topK?: int32(name='TopK'),
  traceTag?: string(name='TraceTag'),
}

model GetPredictResultResponseBody = {
  trace?: string(name='Trace'),
  costTime?: long(name='CostTime'),
  topK?: int32(name='TopK'),
  requestId?: string(name='RequestId'),
  traceTag?: string(name='TraceTag'),
  projectId?: string(name='ProjectId'),
  question?: string(name='Question'),
  predictResults?: [ 
    {
      answer?: string(name='Answer'),
      questionId?: string(name='QuestionId'),
      rank?: int32(name='Rank'),
      score?: float(name='Score'),
      question?: string(name='Question'),
    }
  ](name='PredictResults'),
}

model GetPredictResultResponse = {
  headers: map[string]string(name='headers'),
  body: GetPredictResultResponseBody(name='body'),
}

async function getPredictResultWithOptions(request: GetPredictResultRequest, runtime: Util.RuntimeOptions): GetPredictResultResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('GetPredictResult', '2019-08-13', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function getPredictResult(request: GetPredictResultRequest): GetPredictResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPredictResultWithOptions(request, runtime);
}

model ListProjectsRequest {
  filterParam?: string(name='FilterParam'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  projectType?: string(name='ProjectType'),
}

model ListProjectsResponseBody = {
  totalCount?: int32(name='TotalCount'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  pageNumber?: int32(name='PageNumber'),
  projects?: [ 
    {
      deployAvailable?: string(name='DeployAvailable'),
      createTime?: long(name='CreateTime'),
      projectName?: string(name='ProjectName'),
      projectId?: string(name='ProjectId'),
      questionCount?: int32(name='QuestionCount'),
      deployTime?: long(name='DeployTime'),
      projectType?: string(name='ProjectType'),
      onlineServiceStatus?: string(name='OnlineServiceStatus'),
      testServiceStatus?: string(name='TestServiceStatus'),
      modelName?: string(name='ModelName'),
      dataStatus?: string(name='DataStatus'),
      modelId?: string(name='ModelId'),
    }
  ](name='Projects'),
}

model ListProjectsResponse = {
  headers: map[string]string(name='headers'),
  body: ListProjectsResponseBody(name='body'),
}

async function listProjectsWithOptions(request: ListProjectsRequest, runtime: Util.RuntimeOptions): ListProjectsResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ListProjects', '2019-08-13', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listProjects(request: ListProjectsRequest): ListProjectsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listProjectsWithOptions(request, runtime);
}

model ModifiyProjectRequest {
  projectId?: string(name='ProjectId'),
  modelId?: string(name='ModelId'),
  projectName?: string(name='ProjectName'),
}

model ModifiyProjectResponseBody = {
  requestId?: string(name='RequestId'),
  projectId?: string(name='ProjectId'),
}

model ModifiyProjectResponse = {
  headers: map[string]string(name='headers'),
  body: ModifiyProjectResponseBody(name='body'),
}

async function modifiyProjectWithOptions(request: ModifiyProjectRequest, runtime: Util.RuntimeOptions): ModifiyProjectResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ModifiyProject', '2019-08-13', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function modifiyProject(request: ModifiyProjectRequest): ModifiyProjectResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifiyProjectWithOptions(request, runtime);
}

model UploadDictionaryRequest {
  projectId?: string(name='ProjectId'),
  dictionaryFileUrl?: string(name='DictionaryFileUrl'),
  dictionaryData?: string(name='DictionaryData'),
}

model UploadDictionaryResponseBody = {
  totalCount?: int32(name='TotalCount'),
  requestId?: string(name='RequestId'),
  projectId?: string(name='ProjectId'),
  fileDataCount?: int32(name='FileDataCount'),
  jsonDataCount?: int32(name='JsonDataCount'),
}

model UploadDictionaryResponse = {
  headers: map[string]string(name='headers'),
  body: UploadDictionaryResponseBody(name='body'),
}

async function uploadDictionaryWithOptions(request: UploadDictionaryRequest, runtime: Util.RuntimeOptions): UploadDictionaryResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('UploadDictionary', '2019-08-13', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function uploadDictionary(request: UploadDictionaryRequest): UploadDictionaryResponse {
  var runtime = new Util.RuntimeOptions{};
  return uploadDictionaryWithOptions(request, runtime);
}

model UploadDocumentRequest {
  projectId?: string(name='ProjectId'),
  documentFileUrl?: string(name='DocumentFileUrl'),
  documentData?: string(name='DocumentData'),
}

model UploadDocumentResponseBody = {
  totalCount?: int32(name='TotalCount'),
  requestId?: string(name='RequestId'),
  projectId?: string(name='ProjectId'),
  fileDataCount?: int32(name='FileDataCount'),
  jsonDataCount?: int32(name='JsonDataCount'),
}

model UploadDocumentResponse = {
  headers: map[string]string(name='headers'),
  body: UploadDocumentResponseBody(name='body'),
}

async function uploadDocumentWithOptions(request: UploadDocumentRequest, runtime: Util.RuntimeOptions): UploadDocumentResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('UploadDocument', '2019-08-13', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function uploadDocument(request: UploadDocumentRequest): UploadDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  return uploadDocumentWithOptions(request, runtime);
}

